package com.fruits.validator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 自定义电话号码判断注解
 * 号码为空时返回T
 * 号码不为空时,判断号码是否满足对应正则表达式,满足返回T,
 * 否则返回F
 */
@Target({ElementType.METHOD,ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = PhoneConstraionValidator.class)
public @interface PhoneConstraion {

    String message();

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };
}
